package cn.jy.ad.service.impl;

import cn.jy.ad.common.SnowFlake;
import cn.jy.ad.mapper.ExpressSplitAdvertisingMapper;
import cn.jy.ad.service.SplitAdvertisingService;
import cn.jy.common.ad.domain.ExpressSplitAdvertising;
import cn.jy.common.ad.domain.dto.ExpressSplitAdvertisingDto;
import cn.jy.common.ad.domain.vo.ExpressSplitAdvertisingVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class SplitAdvertisingServiceImpl implements SplitAdvertisingService {

    @Autowired
    private ExpressSplitAdvertisingMapper splitAdvertisingMapper;

    @Override
    public List<ExpressSplitAdvertisingDto> list(ExpressSplitAdvertisingVo vo) {
        return splitAdvertisingMapper.list(vo);
    }

    @Override
    public Integer count(ExpressSplitAdvertisingVo vo) {
        return splitAdvertisingMapper.count(vo);
    }

    @Override
    public void updateStatus(ExpressSplitAdvertising splitAdvertising) {
        splitAdvertisingMapper.updateSplitAd(splitAdvertising);
    }

    @Override
    public void addSplitAdvertising(ExpressSplitAdvertising splitAdvertising) {
        long sn = SnowFlake.nextId();
        splitAdvertising.setSn(String.valueOf(sn));
        splitAdvertisingMapper.addSplitAdvertising(splitAdvertising);
    }


    @Override
    public ExpressSplitAdvertising selectSplidAdById(Integer id) {
        return splitAdvertisingMapper.selectSplidAdById(id);
    }

    @Override
    public void updateSplitAd(ExpressSplitAdvertising splitAdvertising) {
        splitAdvertisingMapper.updateSplitAd(splitAdvertising);
    }

}
